<?php

namespace App\Admin\Forms\User;

use App\Wen\Utils\FieldUtils;
use App\Wen\Utils\Settings;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Form\NestedForm;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;

class UserInviteTepCodeBgForm extends Form implements LazyRenderable
{
    use LazyWidget;

    public function handle(array $input)
    {
        $type = $input['type'];
        return $this->response()->refresh()->success('操作成功');
    }

    public function form()
    {
        $this->html(function () {
            return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">你当前想使用哪个，就把哪个顶到最上面</div>';
        }, '');
        $this->table('app_user_invite_temp_code_bg','背景图', function (NestedForm $table) {
            $table->image('img', '图片')->url('files/uploads')->autoUpload()->uniqueName();
            $table->rate('x_rate', 'x轴偏移');
            $table->rate('y_rate', 'y轴偏移');
            $table->rate('c_rate', '推广码放缩');
        })->default(Settings::get('app_user_invite_temp_code_bg', ''));
    }
}
